package com.xieyong.leetcode;


public class Leetcode1704 {
    public static void main(String[] args) {
        String s = "textbook";
        Leetcode1704 leetcode1704 = new Leetcode1704();
        boolean b = leetcode1704.halvesAreAlike(s);
        System.out.println(b);
    }

    public boolean halvesAreAlike(String s) {
        String str = "aeiouAEIOU";
        int len2 = s.length() / 2;
        int count1 = 0,count2 = 0;
        for (int i = 0; i < len2; i++) {
            if(str.contains(s.substring(i,i + 1))) {
                count1++;
            }
        }
        for (int i = len2; i < s.length(); i++) {
            if(str.contains(s.substring(i,i + 1))) {
                count2++;
            }
        }
        return count1==count2;
    }
}
